﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using TVGrid.TVGridService;

namespace TVGrid.ViewModel
{
    public delegate void VoidWithNoArgsHendler();
    public class ViewModelBase : INotifyPropertyChanged
    {
        public static event VoidWithNoArgsHendler UserLoggedinEvent;
        public static event VoidWithNoArgsHendler StationAddedEvent;
        public static event VoidWithNoArgsHendler UserLoggedoutEvent;

        protected static TVGridServiceClient ServiceClient = new TVGridServiceClient();

        protected void UserLoggedin()
        {
            if (UserLoggedinEvent != null)
            {
                UserLoggedinEvent();
            }
        }

        protected void StationAdded()
        {
            if (StationAddedEvent != null)
                StationAddedEvent();
        }

        public void UserLoggedout()
        {
            if (UserLoggedoutEvent != null)
                UserLoggedoutEvent();
        }

        protected void OnPropertyChanged(string PropertyName)
        {
            if (this.PropertyChanged != null)
                this.PropertyChanged(this, new PropertyChangedEventArgs(PropertyName));
        }
        public event PropertyChangedEventHandler PropertyChanged;
    }
}
